# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: dorphell <dorphell@archlinux.org>

pkgname=libao
pkgver=1.2.2
pkgrel=5
pkgdesc="Cross-platform audio output library and plugins"
url="https://xiph.org/ao/"
arch=('x86_64')
license=('GPL2')
depends=('gcc-libs' 'glibc')
makedepends=('alsa-lib' 'libpulse')
provides=('libao.so')
backup=("etc/${pkgname}.conf")
source=("https://gitlab.xiph.org/xiph/libao/-/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz"
        "${pkgname}.conf")
sha512sums=('d2736d25b60862e7d7469611ce31b1df40a4366ab160e2ff1b46919ae91692d1596c8468e4f016303b306fc3ac1bddc7b727f535a362f403c3fe7c6532e9045a'
            'f50d23993eeab4786e68edec88665783a697c141e8f26d38edbe4deb1c760ec690741c70f39e1ec5edaf07ce18216709ea8c23bd622543796248408ce32e53c4')
b2sums=('e5b5d87c4357ee113769732cb6a7e0afa28b2bc4923be8dacd1fa39ac5fb96d8a5e19bc45137ffc8ec63eef0382130ab9b311aad3a66be4566e0cb9761417b23'
        '5ace51c34b8f9409c5f322ccb1381984b35402866ced3b1b38b2b8fffd10780de80d33418e031decb2cfba452029a48b40df8077d7d67390fcf87bcf57c0cbca')

prepare() {
  cd "${pkgname}-${pkgver}"
  autoreconf -vfi
}

build() {
  cd "${pkgname}-${pkgver}"
  ./configure --prefix=/usr \
              --enable-alsa-mmap
  make
}

package() {
  depends+=('libasound.so' 'libpulse.so' 'libpulse-simple.so')
  cd "${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install
  # default config
  install -vDm 644 "../${pkgname}.conf" -t "${pkgdir}/etc/"
  install -vDm 644 {AUTHORS,CHANGES,HACKING,README,TODO} \
    -t "${pkgdir}/usr/share/doc/${pkgname}"
}
